home *** CD-ROM | disk | FTP | other *** search
/ VisualFX for ImageFX / VisualFX for Image FX 2.adf / Files / ARexx / 02 / 12.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1996-02-04  |  6.3 KB  |  334 lines

  1. /*
  2.                           Visual FX Arexx Script
  3.                            Written By J.L. White
  4.                          (C)1997 Merlin's Software
  5. */
  6.  
  7. Options Results
  8. address "IMAGEFX.1"
  9. ScreenToFront
  10. Undo Off
  11. if exists("libs:flyer.library") then do
  12.     TOASTERLIB="ToasterARexx.port"
  13.     call remlib('ToasterARexx.port')
  14.     call remlib('PROJECT_REXX_PORT')
  15.     call addlib('PROJECT_REXX_PORT' , 0)
  16.     call addlib(TOASTERLIB,0)
  17.     end
  18. call Settings()
  19. call open TempFile,"VFXIFX:TempDrawer/"FXNum".txt",R
  20. line = readln(TempFile)
  21. Type = strip(line)
  22. call close (TempFile)
  23. j=0
  24. TFrames = Frames
  25. if Field = 1 then TFrames = Frames*2
  26. do i = 1 to Frames
  27.     call open TempFile,"RAM:VFXNums",W
  28.     call writeln TempFile,right(i,5,'0')
  29.     call writeln TempFile,right(Frames,5,'0')
  30.     call close TempFile
  31.     f=0
  32.     Redraw Off
  33.     FieldSet = 0
  34.     if Padding ~= -1 & i = 1 then call PadIt(1)
  35.     call LoadB()
  36.     call LoadA()
  37.     j = j+ 1
  38.     call DoIt()
  39.     Redraw On
  40.     call SaveIt()
  41.         if Field = 1 then do
  42.             Redraw Off
  43.             FieldSet = 1
  44.             call LoadB()
  45.             call LoadA()
  46.             j = j + 1
  47.             call DoIt()
  48.             Redraw On
  49.             call SaveIt()
  50.             end 
  51.     if Padding ~= -1 & i = Frames then call PadIt(2)
  52.     end
  53.     if SaveType = 0 then do
  54.         if Padding = -1 then
  55.             call MakeIcon(SaveName,(Frames-10))
  56.         else
  57.             call MakeIcon(SaveName,(Padding+(Frames-10)))
  58.         end
  59.     Undo On
  60. exit
  61.  
  62.  
  63. PadIt:
  64. arg PadNum
  65.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  66.         Undo On
  67.         exit
  68.         end
  69.          if PadNum = 1 then do
  70.        if IAType = 0 then do
  71.         do Pad = Padding to 1 by -1
  72.             LoadBuffer PicAName Force StartA-(Pad-1)
  73.             call Switcher(TOSW)
  74.             call Switcher(MDV1)
  75.             Render Go
  76.                 call RecordAdd(SaveName,2,6,Compression)
  77.             end
  78.         end
  79.        if IAType = 1 then do
  80.         LoadBuffer PicAName Force 1
  81.         call Switcher(TOSW)
  82.         call Switcher(MDV1)
  83.         Render Go
  84.             call RecordAdd(SaveName,2*Padding,6,Compression)
  85.         end
  86.        if IAType = 2 then do
  87.         LoadBuffer PicAName Force
  88.         call Switcher(TOSW)
  89.         call Switcher(MDV1)
  90.         Render Go
  91.             call RecordAdd(SaveName,2*Padding,6,Compression)
  92.         end
  93.        if IAType = 3 then do
  94.         do Pad = Padding to 1 by -1
  95.             LoadBuffer PicAName""right(StartA-(Pad-1),3,'0') Force
  96.             call Switcher(TOSW)
  97.             call Switcher(MDV1)
  98.             Render Go
  99.                 call RecordAdd(SaveName,2,6,Compression)
  100.             end
  101.         end
  102.     end 
  103.     else do
  104.        if IBType = 0 then do
  105.         do Pad = 1 to Padding
  106.             LoadBuffer PicBName Force StartB+Pad+Frames
  107.             call Switcher(TOSW)
  108.             call Switcher(MDV1)
  109.             Render Go
  110.                 call RecordAdd(SaveName,2,6,Compression)
  111.             end
  112.         end
  113.        if IBType = 1 then do
  114.         LoadBuffer PicBName Force 1
  115.         call Switcher(TOSW)
  116.         call Switcher(MDV1)
  117.         Render Go
  118.             call RecordAdd(SaveName,2*Padding,6,Compression)
  119.         end
  120.        if IBType = 2 then do
  121.         LoadBuffer PicBName Force
  122.         call Switcher(TOSW)
  123.         call Switcher(MDV1)
  124.         Render Go
  125.             call RecordAdd(SaveName,2*Padding,6,Compression)
  126.         end
  127.        if IBType = 3 then do
  128.         do Pad = 1 to Padding
  129.             LoadBuffer PicBName""right(StartB+Pad+Frames),3,'0') Force
  130.             call Switcher(TOSW)
  131.             call Switcher(MDV1)
  132.             Render Go
  133.                 call RecordAdd(SaveName,2,6,Compression)
  134.             end
  135.         end
  136.     end
  137. return
  138.  
  139. LoadA:
  140.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  141.         Undo On
  142.         exit
  143.         end
  144.     if j = TFrames then return
  145.     if IAType = 0 then do
  146.         LoadBuffer PicAName Force i+StartA
  147.         end
  148.     if IAType = 1 then do
  149.         LoadBuffer PicAName Force 1
  150.         end
  151.     if IAType = 2 then do
  152.         LoadBuffer PicAName Force
  153.         end
  154.     if IAType = 3 then do
  155.         LoadBuffer PicAName""right(i+StartA,3,'0') Force
  156.         end
  157.  
  158.  
  159. return
  160.  
  161. LoadB:
  162.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  163.         Undo On
  164.         exit
  165.         end
  166.     if j = 1 then return
  167.     if IBType = 0 then do
  168.         LoadBuffer PicBName Force i+StartB
  169.         end
  170.     if IBType = 1 then do
  171.         LoadBuffer PicBName Force 1
  172.         end
  173.     if IBType = 2 then do
  174.         LoadBuffer PicBName Force
  175.         end
  176.     if IBType = 3 then do
  177.         LoadBuffer PicBName""right(i+StartB,3,'0') Force
  178.         end
  179.     Swap
  180. return
  181.  
  182.  
  183. DoIt:
  184.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  185.         Undo On
  186.         exit
  187.         end
  188.     if j = TFrames then do
  189.         Swap
  190.         return
  191.         end
  192.     if j = 1 then do
  193.         GetMain
  194.         parse var result Name Width Height Blah
  195.         return
  196.         end
  197.     if Type = 0 then do
  198.         MainNum = Width
  199.         Num = (((j-1) * MainNum)/(TFrames-1))
  200.  
  201.         Swap
  202.         Scissors
  203.         Box 0 0 Width Height/2
  204.         GetBrush
  205.         parse var result Name BWidth BHeight Blah
  206.         BrushHandle BWidth 0
  207.         Swap
  208.         Point Num 0
  209.         KillBrush
  210.         Swap
  211.         Scissors
  212.         Box 0 Height/2 Width Height
  213.         GetBrush
  214.         parse var result Name BWidth BHeight Blah
  215.         BrushHandle 0 0
  216.         Swap
  217.         Point Width-Num Height/2
  218.         KillBrush
  219.         end
  220.  
  221.     if Type = 1 then do
  222.         MainNum = Width
  223.         Num = (((j-1) * MainNum)/(TFrames-1))
  224.  
  225.         Scissors
  226.         Box 0 0 Width Height/2
  227.         GetBrush
  228.         parse var result Name BWidth BHeight Blah
  229.         BrushHandle BWidth 0
  230.         Swap
  231.         Point Width-Num 0
  232.         KillBrush
  233.         Swap
  234.         Scissors
  235.         Box 0 Height/2 Width Height
  236.         GetBrush
  237.         parse var result Name BWidth BHeight Blah
  238.         BrushHandle 0 0
  239.         Swap
  240.         Point Num Height/2
  241.         KillBrush
  242.         end
  243.  
  244.     if Type = 2 then do
  245.         MainNum = Height
  246.         Num = (((j-1) * MainNum)/(TFrames-1))
  247.  
  248.         Swap
  249.         Scissors
  250.         Box 0 0 Width/2 Height
  251.         GetBrush
  252.         parse var result Name BWidth BHeight Blah
  253.         BrushHandle 0 BHeight
  254.         Swap
  255.         Point 0 Num
  256.         KillBrush
  257.         Swap
  258.         Scissors
  259.         Box Width/2 0 Width Height
  260.         GetBrush
  261.         parse var result Name BWidth BHeight Blah
  262.         BrushHandle 0 0
  263.         Swap
  264.         Point Width/2 Height-Num
  265.         KillBrush
  266.         end
  267.  
  268.     if Type = 3 then do
  269.         MainNum = Height
  270.         Num = (((j-1) * MainNum)/(TFrames-1))
  271.  
  272.         Scissors
  273.         Box 0 0 Width/2 Height
  274.         GetBrush
  275.         parse var result Name BWidth BHeight Blah
  276.         BrushHandle 0 BHeight
  277.         Swap
  278.         Point 0 Height-Num
  279.         KillBrush
  280.         Swap
  281.         Scissors
  282.         Box Width/2 0 Width Height
  283.         GetBrush
  284.         parse var result Name BWidth BHeight Blah
  285.         BrushHandle 0 0
  286.         Swap
  287.         Point Width/2 Num
  288.         KillBrush
  289.         end
  290.  
  291. return
  292.  
  293. SaveIt:
  294.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  295.         Undo On
  296.         exit
  297.         end
  298.     if SaveType = 0 then do
  299.         call Switcher(TOSW)
  300.         call Switcher(MDV1)
  301.  
  302.         Render Go
  303.         if Field = 1 then
  304.                 call RecordAdd(SaveName,1,6,Compression)
  305.         else
  306.                 call RecordAdd(SaveName,2,6,Compression)
  307.         end
  308.  
  309.     if SaveType = 1 then do
  310.         if Field = 1 then do
  311.             f= f + 1
  312.             if f = 1 then
  313.                 SaveBufferAs ILBM "VFXIFX:TempDrawer/PicA"
  314.             if f = 2 then do
  315.                 GetMain
  316.                 parse var result Name Width Height Blah
  317.                 Scale Width Height/2
  318.                 Swap
  319.                 LoadBuffer "VFXIFX:TempDrawer/PicA" Force
  320.                 Scale Width Height/2
  321.                 Hook Interlace
  322.                 SaveBufferAs ILBM SaveName""right(i,3,'0')
  323.                 f = 0
  324.                 end
  325.             end
  326.         else do
  327.             SaveBufferAs ILBM SaveName""right(i,3,'0')
  328.             end    
  329.         end
  330.  
  331. return
  332.  
  333.  
  334.